home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 414_02 / private / _setrows.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-06-17  |  2.3 KB  |  109 lines

  1. #define    CURSES_LIBRARY    1
  2. #include <curses.h>
  3.  
  4. #ifdef PDCDEBUG
  5. char *rcsid__setrows = "$Header: C:\CURSES\private\RCS\_setrows.c 2.1 1993/06/18 20:23:47 MH Rel MH $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_set_rows()    - sets the physical number of rows on screen
  14.  
  15.   PDCurses Description:
  16.      This is a private PDCurses function.
  17.  
  18.      This routine attempts to set the number of rows on the physical
  19.      screen to the passed value.
  20.  
  21.   PDCurses Return Value:
  22.      This function returns OK upon success otherwise ERR is returned.
  23.  
  24.   PDCurses Errors:
  25.      It is an error to attempt to change the screen size on a "bogus"
  26.      adapter.  The reason for this is that we have a known video
  27.      adapter identity problem.  e.g. Two adapters report the same
  28.      identifying characteristics.
  29.  
  30.      It is also an error to attempt to change the size of the Flexos
  31.      console (as there is currently no support for that).
  32.  
  33.   Portability:
  34.      PDCurses    int    PDC_set_rows( int rows );
  35.  
  36. **man-end**********************************************************************/
  37.  
  38. int    PDC_set_rows(int rows)
  39. {
  40. #ifdef    OS2
  41.     VIOMODEINFO modeInfo;
  42.     USHORT result;
  43. #endif
  44.  
  45. #ifdef PDCDEBUG
  46.     if (trace_on) PDC_debug("PDC_set_rows() - called\n");
  47. #endif
  48.  
  49. #ifdef    FLEXOS
  50.     return( ERR );
  51. #endif
  52.  
  53. #ifdef    DOS
  54.     if (_cursvar.bogus_adapter)
  55.         return( ERR );
  56.  
  57.     switch (_cursvar.adapter)
  58.     {
  59.     case _EGACOLOR:
  60.     case _EGAMONO:
  61.         if (rows < 43)
  62.             PDC_set_font(_FONT14);
  63.         else
  64.             PDC_set_font(_FONT8);
  65.         break;
  66.  
  67.     case _VGACOLOR:
  68.     case _VGAMONO:
  69.         if (rows < 28)
  70.             PDC_set_font(_FONT16);
  71.         else
  72.         if (rows < 50)
  73.             PDC_set_font(_FONT14);
  74.         else
  75.             PDC_set_font(_FONT8);
  76.         break;
  77.  
  78.     case _MCGACOLOR:
  79.     case _MCGAMONO:
  80.     case _MDA:
  81.     case _CGA:
  82.     case _MDS_GENIUS:
  83.     default:
  84.         break;
  85.     }
  86.     _cursvar.font = PDC_get_font();
  87.     LINES = PDC_get_rows();
  88.     COLS = PDC_get_columns();
  89.     return( OK );
  90. #endif
  91.  
  92. #ifdef    OS2
  93.     modeInfo.cb = sizeof(modeInfo);
  94.     /* set most parameters of modeInfo */
  95.     VioGetMode(&modeInfo, 0);
  96.     modeInfo.fbType = 1;
  97.     modeInfo.row = rows;
  98.     result = VioSetMode(&modeInfo, 0);
  99.     _cursvar.font = PDC_get_font();
  100.     LINES = PDC_get_rows();
  101.     COLS = PDC_get_columns();
  102.     return ((result == 0) ? OK : ERR);
  103. #endif
  104.  
  105. #ifdef UNIX
  106.     return(0); /* this is N/A */
  107. #endif
  108. }
  109.